package com.base.saas.delivery.controller;

import com.alibaba.csp.sentinel.Entry;
import com.alibaba.csp.sentinel.EntryType;
import com.alibaba.csp.sentinel.SphU;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author 王清亮
 * @date 2025/8/5 22:25
 * @description TODO
 */
@RestController
@RequestMapping("/delivery")
@Slf4j
public class DeliveryController {

    @GetMapping
    public String delivery(@RequestHeader Map<String, String> headers) {
        log.info("DeliveryController delivery");
        return "hello delivery";
    }
    @GetMapping("/test")
    @SentinelResource(
            value = "/delivery/test",
            blockHandler = "handleBlockException",
            blockHandlerClass = {DeliveryBlockHandler.class})
    public String test(@RequestParam String name) {
        return "hello " + name;
    }

}
